package com.bym.controller;

import com.bym.event.MallProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@Slf4j
@RestController
@RequestMapping("/test-order")
public class TestOrderController {

    @Autowired
    private MallProducer mallProducer;

    @GetMapping("/hello")
    public String hello() {
        log.info("hello");
        // 测试 OpenFeign + Hystrix 降级、容错
//        try {
//            Thread.sleep(5000);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

        mallProducer.sendOrderInfo(UUID.randomUUID().toString());
        return "hello bym";
    }
}
